<template>
	<div class="login">
		<view class="logo"></view>
		<view class="welcome"> 欢迎使用 </view>
		<view class="idQuery">
			<view>身份查询</view>
			<input class="inputStyle" name="num" placeholder="请输入学号" v-model="formdata.sno" />
		</view>
		<view>
			<button type="default" form-type="submit" class="loginBtn" @click="login">查询</button>
		</view>
	</div>
</template>

<script>
	const {welcome} = require('../../utils/admin.js')
	export default {
		data() {
			return {
				formdata:{
					sno:""
				}
			}
		},
		methods:{
			login(){
				welcome(this.formdata).then(data=>{
					if(this.formdata.sno === ''){
						uni.showModal({
							content: '学号不能为空',
							showCancel: false
						});
					}else{
						if(data.code === 200){
							uni.navigateTo({
								url: 'login'
							});
						}else{
							uni.navigateTo({
								url: 'register'
							});
						}
					}
				})
			}
		}
	}
</script>

<style scoped src="../../static/css/login.css"></style>
